package com.park.controller;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.park.model.FeeOperationalRecords;
import com.park.service.FeeOperationalRecordsService;
import com.park.service.Utility;

@Controller
@RequestMapping("/feeopera")
public class FeeOperationalRecordsController {
	@Autowired
	FeeOperationalRecordsService feeOperationalRecordsService;
	
	private static Log logger = LogFactory.getLog(PosChargeDataController.class);
	
	@RequestMapping(value="/getInsertFeeOpera",method=RequestMethod.POST,produces={"application/json;charset=utf-8"})
	@ResponseBody
	public String getInsertFeeOpera(@RequestBody FeeOperationalRecords feeOperationalRecords){
		logger.info("请求参数:"+feeOperationalRecords );
		Map<String, Object> result=new HashMap<>();
		int num=feeOperationalRecordsService.insert(feeOperationalRecords);
		logger.info("插入结果："+num );
		if(num==1){
			result.put("status", 1001);
			result.put("message", "ok");
			logger.info("插入成功结果："+feeOperationalRecords );
		}else{
			result.put("status", 1002);
			result.put("message", "failed");
			logger.info("插入失败！："+feeOperationalRecords );
		}
		return Utility.gson.toJson(result);
	}
}
